package com.tanhua.autoconfig;

import cn.hutool.extra.template.Template;
import com.tanhua.autoconfig.propertirs.*;
import com.tanhua.autoconfig.templates.*;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
//开启smsPropeties配置对象的使用，加了注解就会在加载到这个类的时候给配置对象配置值
@EnableConfigurationProperties(
        value = {
                SmsProperties.class,
                OssProperties.class,
                ApiFaceProperties.class,
                HuanXinProperties.class,
                GreenProperties.class
        }
)
public class TanhuaAutoconfiguration {
    @Bean  //创建核心对象交给容器
    public SmsTemplate smsTemplate(){
        return new SmsTemplate();
    }

    @Bean
    public OssTemplate ossTemplate(){return new OssTemplate();}
    @Bean
    public ApiFaceTemplate apiFaceTemplate(){return new ApiFaceTemplate();}
    @Bean
    public HuanXinTemplate huanXinTemplate(HuanXinProperties properties) {
        return new HuanXinTemplate(properties);
    }
    @Bean
    public AliyunGreenTemplate aliyunGreenTemplate(GreenProperties properties){
        return  new AliyunGreenTemplate(properties);}  //有参构造把值传进去赋值给成员变量
}
